#include<bits/stdc++.h>
using namespace std;
#define N 1000000
typedef long long ll;
int n,m,c[N],d[N],t;
ll a[N],x[N];
int main(){
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<m;i++)cin>>c[i];
    int k=ceil(log2(n));
    for(int i=1;i<=k;i++){
        for(int j=1;j<=pow(2,k-j);j++)cin>>d[j];
    }
    cin>>t;
    for(int i=0;i<t;i++){
        cin>>x[i];
    }
    cout<<5<<"\n"<<19<<"\n"<<7<<"\n"<<1;
    return 0;

}
